package com.transaction.simulate.controller;

import com.transaction.common.base.BaseController;
import com.transaction.common.base.PageInfo;
import com.transaction.common.util.ParamsUtil;
import com.transaction.simulate.model.dto.Dict;
import com.transaction.simulate.service.DictService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/dict")
public class DictController extends BaseController {

    private static Logger LOGGER = LoggerFactory.getLogger(ChannelController.class);

    @Autowired
    private DictService dictService;


    @GetMapping("/getDictInfo")
    public Object getDictInfo(HttpServletRequest request){
        PageInfo pageInfo = ParamsUtil.getPageInfo(request);
        Dict dict = ParamsUtil.getBeanParam(new Dict(),request);

        List<Dict> dictList = dictService.getDictInfo(dict,pageInfo);
        pageInfo.setPageResult(dictList);
        return pageInfo;
    }

}
